import request from '@/config/axios'

export interface OrderVO {
  id: number
  orderNo: string
  userId: number
  applyTime: Date
  applyUser: string
  amount: number
  practicalAmount: number
  orderState: string
  states: string
  whether: string
  productId: number
  agentId: number
  equityUserId: number
}

// 查询订单列表
export const getOrderPage = async (params) => {
  return await request.get({ url: `/hutai/order/page`, params })
}

// 查询用户申请订单列表
export const getUserOrderPage = async (params) => {
  return await request.get({ url: `/hutai/client/applyPage`, params })
}

export const getUserOrderByRolePage = async (params) => {
  return await request.get({ url: `/hutai/client/applyPages`, params })
}

export const getWarrantOrderPage = async (params) => {
  return await request.get({ url: `/hutai/order/getWarrantOrderPage`, params })
}

export const getOrderApplicationPage = async (params) => {
  return await request.get({ url: `/hutai/order/salesman-page`, params })
}

// 查询订单详情
export const getOrder = async (id: number) => {
  return await request.get({ url: `/hutai/order/get?id=` + id })
}

// 新增订单
export const createOrder = async (data: OrderVO) => {
  return await request.post({ url: `/hutai/order/create`, data })
}

// 修改订单
export const updateOrder = async (data: OrderVO) => {
  return await request.put({ url: `/hutai/order/update`, data })
}

// 删除订单
export const deleteOrder = async (id: number) => {
  return await request.delete({ url: `/hutai/order/delete?id=` + id })
}

// 导出订单 Excel
export const exportOrder = async (params) => {
  return await request.download({ url: `/hutai/order/export-excel`, params })
}



